package com.hulytu.android.adapter;

import android.view.ViewGroup;

import org.jetbrains.annotations.NotNull;


public interface ViewAdapter<VH extends ViewHolder> {

    int getItemCount();

    int getItemViewType(int position);

    boolean isEmpty();

    @NotNull
    VH onCreateViewHolder(@NotNull ViewGroup parent, int viewType);

    /**
     * 渲染 item 界面，消除 RecyclerView 与 ListView 差异
     *
     * @param holder
     * @param position
     */
    void render(@NotNull VH holder, int position);

    void notifyDataSetChanged();

    void notifyItemChanged(int position);

    void notifyItemRangeChanged(int positionStart, int itemCount);

    void notifyItemInserted(int position);

    void notifyItemRangeInserted(int positionStart, int itemCount);

    void notifyItemRemoved(int position);

    void notifyItemRangeRemoved(int positionStart, int itemCount);
}
